Method for controlling angular position and apparatus therefor

ABSTRACT

A method and apparatus for controlling the angular position of a motor by controlling the revolution of the motor in response to a given positioning command value commanding a predetermined angular position of the motor shaft so as to stop the motor shaft at the predetermined angular position, wherein the acceleration of the motor being accelerated in the initial acceleration stage of the motor position control operation is calculated, and on the basis of the calculated acceleration and a commanded maximum velocity, the remainder angular distance between the deceleration starting angular position and the desired angular position of the motor and the deceleration command value in the deceleration stage are calculated so as to control the deceleration of the motor on the basis of the calculated values.

This invention relates to a method and apparatus for controlling the angular position (referred to hereinafter merely as a position) of a motor. More particularly, this invention relates to a motor position control method and apparatus in which a control circuit is provided so that a motor equipped on its operating shaft with an encoder for measuring or encoding the position of the operating shaft of the motor can be driven at a predetermined revolution velocity, thereby ensuring forward or backward revolution or displacement of a load through a given angle in a stepping mode.

A stepping motor or a motor equipped with a clutch (a clutch motor) is known as an apparatus which can drive a load stepwise through a given angle.

Although the stepping motor has the merit that it can make desired stepping feed of a load under open loop control, it has the demerit that its overall volume increases inevitably when a large torque is required or when a high-speed response is required.

On the other hand, the clutch motor is commonly incorporated in a machine such as an industrial sewing machine and is featured by a good high-speed response. In the industrial sewing machine, it is important for the motor to feed a load stepwise through a given angle within a shortest possible time, and researches and studies have been made to meet the above requirement. However, the clutch motor has still such shortcomings that the clutch tends to be subject to wear relatively rapidly and large noise is generated during on-off of the clutch.

In an effort to obviate the defects pointed out above, a method has been proposed in which a DC motor equipped on its operating shaft with an encoder for detecting the revolution angle of the shaft is employed to improve the high-speed response and useful service life of the motor. Such a method is disclosed in, for example, Barna Szabados et al, "A Time-Optimal Digital Position Controller Using a Permanent-Magnet DC Servomotor", IEEE Transactions on Industrial Electronics and Control Instrumentation, Vol. IECI-19, No. 3, August 1972.

In the disclosed method, the motor is controlled to be capable of angular positioning (referred to hereinafter merely as positioning) by the function of a control circuit including a switching circuit making switching operation in response to the output signal of the encoder to apply a variable voltage across the motor to cause forward or backward revolution of the motor.

Information handling apparatus occupy now a greater proportion of the load of such a motor, and the motor shaft encounters a variety of moments of inertia or load torques.

It has therefore been a prior art practice to directly couple the motor to its control circuit and to suitably adjust the gain or like factor of the control loop, so that the motor under positioning operation can be stopped as smooth as possible with minimized hunting.

Since, in such an arrangement, a variation in the power supply voltage energizing the motor is equivalent to a variation in the gain of the control loop, it has heretofore been required to re-adjust the gain of the control loop whenever such a voltage variation is detected, or to additionally provide a circuit which detects the level of the power supply voltage for the purpose of automatic adjustment of the gain of the control loop.

It is a primary object of the present invention to obviate all of the prior art problems pointed out above and to provide a motor position control method capable of attaining the desired positioning control with minimized hunting regardless of a variation of the inertia of the load or a variation of the current supplied to the motor during the process of positioning control and to provide also a motor position control apparatus which can be directly used for the practice of the control method.

In accordance with one aspect of the present invention, there is provided a method for controlling the angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein the method comprises the steps of reading a commanded maximum velocity; detecting the acceleration of the motor being accelerated in the initial acceleration stage of the motor position control operation; calculating the motor deceleration-start remainder angular distance and the velocity command value for decelerating the motor in the deceleration stage on the basis of the commanded maximum velocity and the detected acceleration; and decelerating the motor on the basis of the calculated motor deceleration-start remainder angular distance and the calculated deceleration velocity command value to stop the motor at the angular position commanded by the given positioning command value.

In accordance with another aspect of the present invention, there is provided a method for controlling the angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein the method comprises the steps of comparing the given positioning command value with a predetermined reference value; detecting the acceleration of the motor being accelerated in the initial acceleration stage of the motor position control operation when the result of comparison in the first step proves that the given positioning command value is not smaller than the predetermined reference value, and calculating the motor deceleration-start remainder angular distance and the velocity command value for decelerating the motor in the deceleration stage on the basis of the detected acceleration and an externally commanded maximum velocity, thereby generating signals indicative of the calculated motor deceleration-start remainder angular distance and the calculated deceleration velocity command value; generating signals indicative of a pregiven motor deceleration-start remainder angular distance and a pregiven deceleration velocity command value or generating signals indicative of the motor deceleration-start remainder angular distance and the deceleration velocity command value used in the previous motor control operation, when the result of comparison in the first step proves that the given positioning command value is smaller than the predetermined reference value; and decelerating the motor on the basis of the motor deceleration-start remainder angular distance and the deceleration velocity command value provided by the signals to stop the motor at the angular position commanded by the given positioning command value.

In accordance with still another aspect of the present invention, there is provided a method for controlling the angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein the method comprises the steps of reading a commanded maximum velocity; detecting the acceleration of the motor being accelerated in the initial acceleration stage of the motor position control operation; calculating the motor deceleration-start remainder angular distance on the basis of commanded maximum velocity and detected acceleration, selecting a most suitable deceleration pattern from among a plurality of previously stored deceleration patterns, and calculating the deceleration velocity command value for executing the control according to the selected deceleration pattern; and decelerating the motor on the basis of the calculated motor deceleration-start remainder angular distance and the calculated deceleration velocity command value to stop the motor at the angular position commanded by the given positioning command value.

In accordance with yet another aspect of the present invention, there is provided an apparatus for controlling the angular position of a rotary shaft of a motor, comprising an encoder supported on said rotary shaft and for encoding the angular position of the rotary shaft, and a control circuit for applying a positive or negative variable voltage across said motor in response to a given positioning command value, wherein the control circuit comprises means for applying the given positioning command value; means for detecting the revolution velocity and angular position of the rotary shaft on the basis of the output of the encoder; signal processing means for calculating the acceleration of the motor in the initial acceleration stage of the motor position control operation, the motor deceleration-start remainder angular distance and the velocity command value for decelerating the motor in the deceleration stage on the basis of the applied given positioning command value, the detected velocity and the detected angular position; and means for driving the motor by applying the positive or negative variable voltage across the motor on the basis of the results of calculation.

In accordance with another aspect of the present invention, there is provided an apparatus for controlling the angular position of a rotary shaft of a motor, comprising an encoder supported on said rotary shaft and for encoding the angular position of the rotary shaft, and a control circuit for applying a positive or negative variable voltage across the motor in response to a given positioning command value, wherein the control circuit comprises means for applying the given positioning command value; means for detecting the revolution velocity and angular position of the rotary shaft on the basis of the output of the encoder; means for applying a maximum velocity command value; signal processing means for processing signals indicative of the applied given positioning command value, the applied maximum velocity command value, the detected velocity and the detected angular position and generating the results of signal processing; and mens for driving the motor by applying the positive or negative variable voltage across the motor on the basis of the results of signal processing by the signal processing means, the signal processing means calculating the acceleration of the motor being accelerated in the initial acceleration stage of the motor position control operation on the basis of the signals indicative of the velocity and angular position of the rotary shaft when the result of comparison between the given positioning command value and a predetermined reference value proves that the former is not smaller than the latter, and calculating the motor deceleration-start remainder angular distance and the deceleration velocity command value on the basis of the calculated acceleration and the given maximum velocity for generating them as the results of signal processing.

The above and other objects, features and advantages of the present invention will become more apparent from the following detailed description of preferred embodiments thereof taken in conjunction with the accompanyin drawings, wherein:

FIG. 1 is a diagram illustrating especially the mode of deceleration during motor position control;

FIG. 2 is a diagram illustrating an improved mode of deceleration in the case of the position control indicated by the one-dot chain lines in FIG. 1;

FIG. 3 is a graph illustrating the manner of calculating the acceleration by measuring the rate of change of velocity per unit time;

FIG. 4 is a graph illustrating the manner of calculating the acceleration by measuring the length of time required until a unit velocity change is attained;

FIG. 5(a) is a graph showing the relation between the time and the velocity of the motor until the motor rotating at the steady velocity is decelerated to stop at the desired position, and

FIG. 5(b) is a graph showing the relation between the time and the remainder angular distance over which the motor is driven in the manner shown in FIG. 5(a) to reach the desired position;

FIG. 6 is a graph showing the relation between the velocity and the remainder angular distance calculated on the basis of the relations shown in FIG. 5;

FIGS. 7A to 7C are graphs illustrating the step of calculating the remainder angular distance for which the motor should start to be decelerated to reach the desired position and the step of calculating the deceleration velocity command value;

FIG. 8 shows the structure of an embodiment of the motor position control apparatus according to the present invention;

FIG. 9 is a block diagram showing schematically the structure of one form of the revolution direction detection circuit in the embodiment shown in FIG. 8;

FIG. 10 is a time chart illustrating the operation of the circuit shown in FIG. 9;

FIG. 11 is a block diagram showing schematically the structure of one form of the position detection circuit in the embodiment shown in FIG. 8;

FIG. 12 is a time chart illustrating the operation of the circuit shown in FIG. 11;

FIG. 13 is a block diagram showing schematically the structure of one form of the velocity detection circuit in the embodiment shown in FIG. 8;

FIG. 14 is a time chart illustrating the operation of the circuit shown in FIG. 13;

FIG. 15 is a block diagram showing schematically the structure of one form of the drive circuit in the embodiment shown in FIG. 8;

FIG. 16 is a time chart illustrating the operation of the circuit shown in FIG. 15;

FIG. 17 is a block diagram illustrating schematically the functions of the microcomputer in the embodiment shown in FIG. 8;

FIGS. 18 to 20 are flow charts illustrating various forms of the motor position control method according to the invention; and

FIG. 21 is a graph illustrating how a most suitable deceleration pattern is selected.

For a better understanding of the present invention, the basic technical idea and principal features of the present invention will now be explained before describing preferred embodiments of the present invention in detail.

First of all, various factors will be considered which have a concern with the positioning control of a motor having an encoder mounted on its operating shaft.

(1) Positioning command value θ_(o) (rad)

This command value θ_(o) represents the angular distance over which the operating shaft of the motor is to be rotated in the forward or backward direction from its starting position until it is stopped at the desired position.

In the case of the clutch motor incorporated in, for example, an industrial sewing machine, this command value θ_(o) exceeds scarcely the angle corresponding to one revolution of the operating shaft of the motor. However, in the case of a motor incorporated in, for example, a printer used with a data processor, it is not seldom that the positioning command value θ_(o) exceeds 1,800 in terms of the degree unit, that is, the angle corresponding to more than several revolutions of the motor shaft.

(2) The number of pulses P per revolution of the encoder directly coupled to the motor shaft

The larger the number of pulses P, the higher is the resolution of the feed angle which can be selected during the positioning control (the number of selectable feeds).

When the positioning command value θ_(o) (rad) is expressed in terms of the number of pulses P, that value θ_(op) (pulses) is as follows: ##EQU1##

(3) Motor torque T_(M) (Kg-m)

This represents the torque produced by the motor and is expressed as follows:

    T.sub.M =K.sub.t ·I.sub.M                         (2)

where K_(t) is the torque constant (Kg-m/A) of the motor, and I_(M) is the motor current (A).

This torque constant K_(t) is peculiar to each individual motor and is given by the following equation (3):

    K.sub.t =K.sub.1 ·N.sub.1 ·φ         (3)

where K₁ is a constant, N₁ is the number of turns of the winding of the motor, and φ is the magnetic flux (wb) in the motor.

Small-sized motors rated at less than several hundred watts are most frequently employed in information handling apparatus, and a permanent magnet motor is the most typical one of them. The permanent magnet of such a motor produces the magnetic flux φ above described, and the value of the magnetic flux φ produced by the permanent magnet is variable depending on the temperature. The temperature coefficient is -0.2%/°C. in the case of a ferrite magnet. This means that a 20% variation occurs in the magnetic flux when, for example, the temperature is raised up to 80° C. from -20° C.

The motor current I_(M) is given by the following equation (4): ##EQU2## where E is the voltage (V) applied across the motor. This motor voltage E is obtained by chopping the power supply voltage E_(dc) (V) by a control circuit including a plurality of switching elements, for example, a thyristor chopper circuit providing the duty factor D_(t) and is given by the following equation (5):

    E=D.sub.t ·E.sub.dc (V)                           (5)

E_(o) in the equation (4) represents the voltage (V) induced in the motor and is given by the following equation (6):

    E.sub.o =K.sub.2 ·ω·N.sub.1 ·φ(6)

where K₂ is a constant, ω is the angular velocity (rad/sec) of the motor under rotation, and N₁ and φ are the number of turns of the winding of the motor and the magnetic flux in the motor respectively, as described already.

In the equation (4), R(Ω) represents the sum of the resistance R.sub.α (Ω) of the armature of the motor and the resistance R_(x) (Ω) of the wiring extending from the control circuit to the motor. The armature resistance R.sub.α of the motor is variable depending on the operating temperature of the motor.

(4) Moment of inertia J (Kg-m·sec²) of motor shaft

The moment of inertia J is given by the following equation (7):

    J=J.sub.M +J.sub.L                                         (7)

where J_(M) is the moment of inertia of the motor, and J_(L) is the moment of inertia of a load coupled to the motor shaft when converted into that of the motor shaft.

(5) Load torque T_(L) (Kg-m)

The difference between this load torque T_(L) and the motor torque T_(M) given by the equation (2) provides the acceleration torque T₁ available for accelerating the motor shaft. Thus, the acceleration torque T₁ is given by the following equation (8):

    T.sub.1 =T.sub.M -T.sub.L                                  (8)

On the other hand, the deceleration torque T₂ available for the deceleration of the motor shaft is given by the following equation (9) since the direction of the load torque T_(L) is the same as that of the starting torque:

    T.sub.2 =T.sub.M +T.sub.L                                  (9)

(6) Allowable maximum velocity ω₁₋₁ (rad/sec)

The velocity ω of the motor under rotation attains its maximum value ω_(m) when the voltage E applied across the motor has its maximum value E_(m). However, depending on the character of a load such as a printer in an information handling apparatus to which the motor is coupled, the motor is not allowed to rotate at its maximum velocity ω_(m) and is allowed, in most cases, to rotate at an allowable maximum operating velocity ω₁₋₁ (ω₁₋₁ <ω_(m)).

This allowable maximum velocity ω₁₋₁ is selected to be a value which fully satisfies the operation of the apparatus and sufficiently ensures the reliability and durability of the apparatus. Thus, the allowable maximum velocity ω₁₋₁ of the motor is determined to meet the mechanism and operation of the apparatus. Therefore, the allowable maximum velocity ω₁₋₁ of the motor is not always the same and is dependent upon the mechanism of the specific apparatus in which the motor is installed.

(7) Acceleration α₁ and deceleration α₂ (rad/sec²)

The acceleration α₁ and deceleration α₂ of the motor are given by the following equations (10) and (11) respectively: ##EQU3##

For the optimized positioning control of the motor, how to control the velocity of the motor for rotating the motor shaft to the desired position will then be considered.

The instantaneous position θ (rad) of the motor shaft, that is, the angular distance (referred to hereinafter merely as a distance) over which the motor shaft has rotated from its starting position, is given as a function of the velocity ω (rad/sec) of the motor as follows: ##EQU4##

It can be seen that the position θ is calculated by integrating the velocity ω with time.

The motor operates in a manner as will be described now in response to the positioning command θ_(o) indicative of the desired position to which the motor shaft is to be rotated. The motor is initially accelerated from the velocity ω=0 in the standstill state to the commanded maximum velocity ω₁ (rad/sec) (ω₁ <ω₁₋₁), and is steadily rotated at this commanded maximum velocity ω₁ for a certain length of time. Judgement is then made as to whether or not the remainder distance θ.sub.α (rad) from the present position to the desired position (referred to hereinafter merely as a remainder distance) is close to the value at which deceleration is to be started, and, when the result of judgement proves that the remainder distance θ_(d) (rad) is close to the deceleration starting value, the motor is decelerated from the commanded maximum velocity ω₁.

FIG. 1 illustrates how the motor is accelerated and then decelerated. FIG. 1 shows in (a) the time-related change of the motor velocity ω, in (b) the time-related change of the motor current I_(M) and in (c) the time-related movement of the motor position θ.

The solid curves in (a), (b) and (c) of FIG. 1 represent the velocity, current and position when the motor and its control circuit are sufficiently adjusted to meet the mechanism of the specific apparatus, and it will be seen that the motor operates and stops smoothly without hunting. On the other hand, the one-dot chain curves indicate that, due to application of the motor to another apparatus or due to a different level of the control voltage in the control circuit, the same motor and same control circuit are not ineffective resulting in appearance of hunting.

At first, the motor operation represented by the solid curves will be explained.

In FIG. 1(a), t₁, t₂ and t₃ represent the length of time required for accelerating the motor from the initial velocity ω=0 to the commanded maximum velocity ω₁, the length of time required for decelerating the motor from the commanded maximum velocity ω₁ to the velocity ω=0, and the length of time during which the motor is rotated steadily at the commanded maximum velocity ω₁, respectively.

In FIG. 1(b), the motor current I_(M) has the same value during the stages of acceleration and deceleration, but its direction in the deceleration stage is opposite to that in the acceleration stage. It will be seen that the value of the motor current I_(M) in the steady operation stage rotating at the commanded maximum velocity ω₁ is very small compared with those in the acceleration and deceleration stages.

FIG. 1(c) illustrates that, until the position θ attains the value commanded by the positioning command θ_(o), the position θ moves in a parabolic mode in the acceleration stage, in a linear mode in the steady operation stage, and in an exponential mode in the deceleration stage.

The value of the remainder distance θ_(d) over which the motor shaft is to be rotated to reach the desired position θ_(o) is θ_(d1) at the time at which the motor starts to be decelerated. When the velocity ω is reduced to zero, the remainder distance θ.sub.α is approximately zero to attain the relation θ=θ_(o), so that the motor can be smoothly stopped.

In contrast, in the case of the motor operation represented by the one-dot chain curves, both of the acceleration and the deceleration are lower by 30% than those in the case represented by the solid curves. This means, for example, that, due to the incorporation of the motor in a different apparatus or due to the supply of power supply voltage of different level to the control circuit, the values of the acceleration α₁ and deceleration α₂ calculated according to the equations (10) and (11) respectively decrease by 30% compared with the aforementioned values. Thus, the acceleration α₁ ' and deceleration α₂ ' in such a case are given by α₁ '=0.7 α₁ and α₂ '=0.7 α₂.

In the case of the motor operation represented by the one-dot chain curves, therefore, the length of time t₁ required for acceleration is longer by 30% than that represented by the solid curve. The motor is similarly steadily rotated at the commanded maximum velocity ω₁ after attainment of that velocity level, and the stage of deceleration starts as soon as the remainder distance θ_(d) attains the value θ_(d1) at which the deceleration is to be started. At time t₄ at which the velocity ω is finally decreased to zero, the position θ exceeds the positioning command value θ_(o) by Δθ₁. This is attributable to the fact that the length of time of deceleration increases by 30% compared with that represented by the solid curve because of the 30% decrease in the deceleration, and, consequently, the distance to be moved by the motor in the stage of deceleration becomes longer than the remainder distance θ_(d1) indicative of the value at which deceleration is to be started.

The direction of revolution of the motor is reversed at time t₄ so as to reduce the excess Δθ₁ to zero. In this manner, the motor is finally stopped, while hunting a plurality of times, by the combination of the damping action of the control system and the function of a stop control routine.

It will be understood from the above description that the present invention is based upon finding of the fact that there is a fixed relationship between the acceleration in the acceleration stage and the deceleration in the deceleration stage. The present invention is featured by measuring the acceleration in the acceleration stage and, on the basis of the measured acceleration, calculating the remainder distance θ_(d1) indicative of the value at which the motor starts to be decelerated (referred to hereinafter merely as a deceleration-start remainder distance). The above feature of the present invention will now be described in further detail.

From the aforementioned equations (10) and (11), the relation between the deceleration α₂ and the acceleration α₁ can be expressed as follows: ##EQU5##

Therefore, the deceleration-start remainder distance θ_(d1) can be determined as follows: ##EQU6## where K_(ad) is (T_(M) -T_(L))/(T_(M) +T_(L)) which is a constant.

In the value of the acceleration α₁ measured in the method and apparatus according to the present invention, consideration is taken with respect to the effects of the motor current I_(M), magnetic flux φ, power supply voltage E_(dc), duty factor D_(t), motor armature resistance R.sub.α, wiring resistance R_(x), moment of inertia J_(M) of the motor and moment of inertia J_(L) of the load. Therefore, the value of the deceleration α₂ required for decelerating the stepping motor feeding stepwise the load through a given angle can be accurately calculated for each stepping feed. Further, due to the fact that the deceleration-start remainder distance θ_(d1) is calculated for each stepping feed of the load, the motor can be smoothly stopped without hunting at the end of its stepping feed in a manner as shown by the solid curve in FIG. 1(c).

The one-dot chain curves shown in FIG. 1 are thus improved as shown by the solid curves in FIG. 2. For simplicity of explanation, it is assumed that the load torque T_(L) is negligibly small compared with the motor torque T_(M) developed during acceleration and deceleration. That is, it is assumed that K_(ad) ≈1. As a matter of fact, T_(L) is less than several percent of T_(M) in various fields of application to information handling apparatus. Under the above condition in which K_(ad) is regarded to be K_(ad) ≈1, the deceleration α'₂ and the deceleration-start remainder distance θ_(d2) can be calculated according to the following equations:

    α'.sub.2 =α'.sub.1                             (15) ##EQU7## From the equation (16), θ.sub.d2 is expressed as ##EQU8## It will be understood therefore that θ.sub.d2 is 1.5 times as large as θ.sub.d1.

Herein, the value of the motor current I_(M) in the deceleration stage is assumed to be the same as that in the acceleration stage. Considering the fact that the motor is commonly accelerated and decelerated within a shortest possible time, the value of the motor current I_(M) can be regarded to be the same as that limited by the current capacity of the control circuit.

The method of measuring the acceleration is classified into the method of measuring the rate of velocity change per unit time and the method of detecting the length of time required for the velocity to make a unit change.

FIG. 3 illustrates the former method. In FIG. 3, the velocity ω_(u) at time t=t_(u) at which a unit length of time has elapsed from the starting time t=0 (ω=0), is measured, and, on the basis of the measured velocity ω_(u), the acceleration α₁ is calculated according to the following equation (17):

    α.sub.1 =ω.sub.u /t.sub.u                      (17)

However, the acceleration α₁ need not necessarily be measured from the starting time t=0 (ω=0) in the manner shown in FIG. 3. The acceleration α₁ may be calculated by measuring the velocity ω=ω_(b) at time t=t_(b) at which a unit length of time t_(u) has elapsed from arbitrarily selected time t=t_(a) (ω=ω_(a)) and dividing the velocity increment ω_(b) =ω_(a) by the unit length of time t_(u) =t_(b) -t_(a).

FIG. 4 illustrates the latter method. In FIG. 4, the change of the velocity until the commanded maximum velocity ω₁ is attained after starting at time t=0 (ω=0) is taken as a unit velocity change, and the length of time t₁ required for making this unit velocity change is measured so as to calcuate the acceleration α₁ according to the following equation (18):

    α.sub.1 =ω.sub.1 /t.sub.1                      (18)

While ω₁ is considered to represent the unit velocity change in the above calculation, this is not necessarily an essential requirement. Thus, as described already with reference to FIG. 3, time t=t_(d), at which the velocity ω=ω_(c) at arbitrarily selected time t=t_(c) increases by a unit velocity change ω_(u) to attain the velocity ω=ω_(d), is measured, and the unit velocity change ω_(u) =ω_(d) -ω_(c) is divided by the length of time t_(d) -t_(c) required therefor to calculate the acceleration α₁.

The acceleration α₁ calculated in the manner described with reference to FIG. 3 or 4 is utilized for the calculation of the deceleration α₂ according to the equation (13) or from the relation α₂ =α₁ in which K_(ad) is assumed to be K_(ad) ≈1 as described hereinbefore. The deceleration-start remainder distance θ_(d1) can also be calculated according to the equation (14). The deceleration α₂ ' and the deceleration-start remainder distnce θ_(d2) described hereinbefore can also be entirely similarly calculated according to the equations (15) and (16) respectively, and any detailed description will be unnecessary.

The thus calculated deceleration α₂ or α₂ ' is replaced by the velocity ω corresponding to the deceleration-start remainder distance θ_(d) in the practical control. The improved method represented by the solid curves shown in FIG. 2 will now be considered. FIGS. 5(a) and 5(b) show the time-related change of the velocity ω in the deceleration stage and that of the deceleration-start remainder distance θ_(d) respectively.

Suppose that the deceleration stage starts at time t=0. Then, the deceleration-start remainder distance θ_(d) and velocity ω are expressed as follows:

    θ.sub.d =θ.sub.d2 -(ω.sub.1 ·t-1/2·α'.sub.2 ·t.sup.2) (19)

    ω=ω.sub.1 -α'.sub.2 ·t          (20)

Elimination of t from the equations (19) and (20) provides the following equation (21): ##EQU9## Substitution of the equations (15) and (16) into the equation (21) provides the following equation (22): ##EQU10## The above value is obtained under assumption of K_(ad) ≈1, and it is apparent that the following equation (23) generally holds: ##EQU11## where C' is a constant.

This applies entirely similarly to the solid curves shown in FIG. 1, and the velocity ω can be expressed as ##EQU12##

Suppose that the value of the acceleration α₁ (or α₁ ') the equations (22) to (25) is already known. Then, the relation between the velocity ω and the deceleration-start remainder distance θ_(d) will be as shown in FIG. 6. That is, by measuring the acceleration α₁ (or α₁ ') in the acceleration stage, substituting the measured value of the acceleration α₁ (or α₁ ') into the equations (22) to (25) and calculating the relation between the velocity ω and the deceleration-start remainder distance θ_(d), the instantaneous velocity ω_(N) (the command value) of the motor shaft being decelerated from the command maximum velocity ω=ω₁ to the velocity ω= can be calculated. In this manner, by measuring the acceleration α₁ (or α₁ ') in the acceleration stage and, on the basis of the measured value of the acceleration α₁ (or α₁ '), calculating the velocity command value ω_(N) relative to the deceleration-start remainder distance θ_(d) for each stepping operation of the motor, the positioning control dealing sufficiently with the factors including the load variation can be smoothly attained.

Aside from the foregoing discussion, the timing for calculating the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and the timing for calculating the velocity command value ω_(N) in the deceleration stage will now be discussed.

Basically, it is desirable to calculate the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and velocity command value ω_(N) in the deceleration stage each time the positioning command value θ_(O) is refreshed and the motor is accelerated under positioning control. For the purpose of the above calculation, it is necessary to calculate the acceleration α₁ (or α₁ ') by dividing the velocity by the unit length of time and to calculate the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and velocity command value ω_(N) in the deceleration stage on the basis of the calculated value of the acceleration α₁ (or α₁ ').

In the method in which the acceleration α₁ (or α₁ ') is calculated on the basis of the unit velocity, a length of time is required until the unit velocity is attained, and another length of time is required to calculate the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and velocity command value ω_(N) in the deceleration stage on the basis of the calculated length of time. Therefore, when the positioning command value θ_(O) is too small to secure the former length of time, it is impossible to carry out the method in which the acceleration α₁ (or α₁ ') is calculated to calculate the values of θ_(d1) (or θ_(d2)) and ω_(N) for the purpose of positioning control.

It is therefore another feature of the present invention that the positioning control is carried out by fetching the positioning command value θ_(O), comparing it with a predetermined reference value θ_(c) (rad) so as to find whether or not the positioning command value θ_(O) is large enough to newly calculate the values of θ_(d1) (or θ_(d2)) and ω_(N), and, when the result of comparison proves that θ_(O) <θ_(c), using pregiven values of θ_(d1) (or θ_(d2)) and ω_(N) or the values of θ_(d1) (or θ_(d2)) and ω_(N) having been calculated in the previous step of positioning control.

Such a mode of positioning control is shown in FIG. 7. FIGS. 7A, 7B and 7C represent the relation between the velocity ω and the time when the relation between θ_(O) and θ_(c) is θ_(O) >>θ_(c), θ_(O) >θ_(c) and θ_(O) <θ_(c) respectively. In the case of FIGS. 7A and 7B, the acceleration α₁ (or α₁ ') the acceleration stage is calculated to calculate the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and velocity command value ω_(N), while, in the case of FIG. 7C, the values of θ_(d1) (or θ_(d2)) and ω_(N) are not calculated due to the impossibility of calculation of the acceleration α₁ (or α₁ '), and the pregiven or previously calculated values of θ_(d1) (or θ_(d2)) and ω_(N) are used.

An embodiment of the motor position control method according to the present invention will be described together with an embodiment of the motor position control apparatus according to the present invention with reference to FIGS. 8 to 19.

Referring first to FIG. 8 showing the structure of an embodiment of the motor position control apparatus according to the present invention, an H-shaped bridge circuit including transistors 20 to 23 and a bridge circuit including diodes 24 to 27 are connected across a DC power source 1. More precisely, the collectors of the transistors 20, 22 and the cathodes of the diodes 24, 26 are connected to the positive terminal of the power source 1, and the emitters of the transistors 21, 23 and the anodes of the diodes 25, 27 are connected to the negative terminal of the power source 1.

The emitter of the transistor 20, the collector of the transistor 21, the anode of the diode 24 and the cathode of the diode 25 are connected to one of the terminals of a stepping motor 2, while the emitter of the transistor 22, the collector of the transistor 23, the anode of the diode 26 and the cathode of the diode 27 are connected to the other terminal of the motor 2.

The shaft of the motor 2 drives a load 3 and an encoder 4, and the encoder 4 generates its output signal 10 indicative of revolution of the motor 2. This output signal 10 is applied to a revolution direction detection circuit 5, a position detection circuit 6 and a velocity detection circuit 7.

The revolution direction detection circuit 5 generates its output signal 11 indicative of the direction of revolution of the motor 2, and this signal 11 is applied to a microcomputer 9 and also to the position detection circuit 6.

The position detection circuit 6 generates its output signal 12 indicative of the position of the motor 2, and the velocity detection circuit 7 generates its output signal 13 indicative of the velocity of the motor 2. The position signal 12 and the velocity signal 13 are also applied to the microcomputer 9. In addition to the signals above described, a positioning command signal 18 and a maximum velocity command signal 19 are externally applied to the microcomputer 9.

The microcomputer 9 generates a duty factor signal 14 and a forward/backward revolution signal 15 which are applied to a drive circuit 8. A forward revolution signal 16 appearing from the drive circuit 8 is connected to the bases of the transistors 21, 22, and a backward revolution signal 17 appearing from the drive circuit 8 is connected to the bases of the transistors 20, 23.

The operation of the apparatus having such a construction will now be described.

In response to the application of the positioning command signal 18 and maximum velocity command signal 19, the microcomputer 9 executes necessary calculation on the inputs including the revolution direction signal 11 indicative of the direction of revolution of the motor 2, the position signal 12 indicative of the position of the motor 2 and the velocity signal 13 indicative of the velocity of the motor 2. After the calculation, the microcomputer 9 applies to the drive circuit 8 the duty factor signal 14 for controlling the voltage applied across the motor 2 and the forward/backward revolution signal 15 for determining the direction of revolution of the motor 2.

When the motor 2 rotates in the forward direction, the forward revolution signal 16 appears from the drive circuit 8, and the transistors 21 and 22 are turned on to control the voltage according to the duty factor provided by the duty factor signal 14, thereby providing the rotating force for rotating the motor 2 in the forward direction.

In the initial stage of acceleration, the motor position indicated by the position signal 12 does not conform to that commanded by the positioning command signal 18. In such a stage, therefore, the duty factor of the voltage applied across the motor 2 is increased so that the velocity of the motor 2 can be increased at a rapid rate.

As the velocity of the motor 2 increases until the velocity indicated by the velocity signal 13 approaches the maximum velocity commanded by the maximum velocity command signal 19, the backward revolution signal 17 appears now from the drive circuit 8 so that the motor 2 can be stopped at the position commanded by the positioning command signal 18. In response to the application of the signal 17, the transistors 20 and 23 are turned on, and braking force is imparted to the motor 2 so that the motor 2 can be quickly and stably stopped at the position commanded by the positioning command signal 18.

The structure and operation of the various blocks shown in FIG. 8 will now be described in further detail.

FIG. 9 shows the structure of the revolution direction detection circuit 5. Referring to FIG. 9, a revolution signal 10-1 of one phase is applied from the encoder 4 to the clock terminal 52 of a D-type flip-flop 51, and another revolution signal 10-2 of a different phase is applied from the encoder 4 to the D terminal 53 of the flip-flop 51.

The input applied to the clock terminal 52 triggers the flip-flop 51 with its rising edge. Therefore, when the phase of the revolution signal 10-2 applied from the encoder 4 advances relative to that of the revolution signal 10-1, as in a range before time te shown in FIG. 10, the revolution signal 10-2 applied to the D terminal 53 of the flip-flop 51 is in its "1" level at the rise time of the revolution signal 10-1 applied to the clock terminal 52, and the revolution direction signal 11 appearing from the output terminal 54 of the flip-flop 51 is in its "1" level as shown in FIG. 10.

On the other hand, when the direction of revolution of the encoder 4 is changed, and the phase of the revolution signal 10-2 delays relative to that of the revolution signal 10-1 as in a range after time t_(e) shown in FIG. 10, the revolution signal 10-2 applied to the D terminal 53 of the flip-flop 51 is in its "0" level at the rise time of the revolution signal 10-1 applied to the clock terminal 52, and the revolution direction signal 11 appearing from the output terminal 54 of the flip-flop 51 is in its "0" level. In the manner above described, the revolution direction detection circuit 5 can detect the direction of revolution of the motor 2.

The structure of the position detection circuit 6 will be described in detail with reference to FIG. 11.

Referring to FIG. 11, the position detection circuit 6 includes an up/down counter 61 and a latch 62. The revolution signal 10 is applied as a clock input to the up/down counter 61, and the revolution direction signal 11 is applied as an up/down input.

Outputs P_(o) to P_(n) from the bit output terminals of the up/down counter 61 are connected to the corresponding bit input terminals of the latch 62, and outputs from the bit output terminals of the latch 62 are applied as the position signal 12.

A strobe signal 63 is applied to the strobe terminal of the latch 62 to latch the contents of the up/down counter 61. A reset signal 64 is applied to the reset input terminals of the up/down counter 61 and latch 62.

FIG. 12 is a time chart illustrating the operation of the position detection circuit 6. The up/down counter 61 counts the pulses of the revolution signal 10 applied as its clock input. The counter 61 operates as a count-up counter and counts up the input pulses during the period of time (before time t_(e)) in which the revolution direction signal 11 remains in its "1" level. Thus, before time t_(e), the output signal of the counter is represented by P_(o) to P₂ as shown in FIG. 12.

However, when the direction of revolution of the motor 2 is reversed at time t_(e), the revolution direction signal 11 turns into its "0" level after time t_(e) as shown in FIG. 12, and the up/down counter 61 operates now as a down counter and starts to count down.

The strobe signal 63 is applied to the latch 62 at intervals of a predetermined period of time to latch the contents of the up/down counter 61 so that the position signal 12 can indicate the renewed value of the position.

In response to the application of a new positioning command signal 18, the reset signal 64 is applied to the reset terminals of the up/down counter 61 and latch 62 to reset the same.

The velocity detection circuit 7 includes a counter 71 and a latch 72 as shown in FIG. 13.

The revolution signal 10 from the encoder 4 is applied as a clock input to the counter 71, and a counter enable signal 73 having a predetermined pulse width and a counter reset signal 74 are applied to the enable terminal and reset terminal respectively of the counter 71.

Outputs S_(o) to S_(n) from the bit output terminals of the counter 71 are connected to the corresponding bit input terminals of the latch 72, and outputs from the bit output terminals of the latch 72 are applied to the microcomputer 9 as the velocity signal 13. A strobe signal 75 is applied to the strobe terminal of the latch 72.

FIG. 14 is a time chart illustrating the operation of the velocity detection circuit 7. The counter 71 continues to count the pulses of the revolution signal 10 during the lasting period of the counter enable signal 73 to generate its outputs S_(o) to S_(n) as shown in FIG. 14.

The latch strobe signal 75 is then applied to the strobe terminal of the latch 72 to latch the outputs S_(o) to S_(n) applied from the counter 71. As soon as the counter outputs are latched, the counter reset signal 74 is applied to the reset terminal of the counter 71 to reset the same, and the counter 71 is now ready to receive the next input 10.

Therefore, the counter 71 continues to count the pulses of the revolution signal 10 during the predetermined lasting period of the counter enable signal 73, so that the velocity signal 13 has the value proportional to the velocity of the motor 2.

The drive circuit 8 includes an inverter gate 81 and a pair of AND gates 82 and 83 as shown in FIG. 15. The duty factor signal 14 is connected to one of the input terminals of each of the AND gates 82 and 83. The forward/backward revolution signal 15 is connected to the other input terminal of the AND gate 82 and to the other input terminal of the AND gate 83 through the inverter gate 81.

FIG. 16 is a time chart illustrating the operation of the drive circuit 8 having such a structure. In response to the application of the duty factor signal 14 and forward/backward revolution signal 15 to the drive circuit 8, the duty factor signal 14 appears at the output terminal of the AND gate 82 to provide the forward revolution signal 16 during only the period of time in which the forward/backward revolution signal 15 is in its "1" level.

On the other hand, the duty factor signal 14 appears at the output terminal of the AND gate 83 to provide the backward revolution signal 17 during only the period of time in which the forward/backward revolution signal 15 is in its "0" level.

The microcomputer 9 includes a central processor unit (CPU), a random access memory (RAM), a read-only memory (ROM) and an input/output interface and operates according to a program stored in the ROM.

FIG. 17 is a block representation of the operation of the microcomputer 9.

When the positioning command signal 18 and maximum velocity command signal 19 are externally applied to the CPU through the input/output interface, the positioning command signal 18 is compared with the position signal 12 indicative of the present position of the motor shaft, and, on the basis of the maximum velocity command signal 19, the corresponding velocity command value ω_(N) is calculated.

Then, in response to the application of the velocity signal 13 indicative of the present velocity of the motor, the duty factor corresponding to the difference between the present velocity and the command velocity ω_(N) is calculated, and the duty factor signal 14 indicative of the calculated duty factor is applied from the microcomputer 9 to the drive circuit 8.

In response to the application of the revolution direction signal 11, whether the direction of revolution of the motor 2 is forward or backward is judged on the basis of the signals including the positioning command signal 18 and position signal 12, and the forward/backward revolution signal 15 is applied from the microcomputer 9 to the drive circuit 8.

The details of the motor position control method controlling the position of the motor 2 by the apparatus having the construction above described will now be described with reference to a flow chart of FIG. 18.

In the initial step of the program, the positioning command value θ_(o) is compared with the pregiven reference value θ_(c). That is, when the program is started, the externall-applied commanded maximum velocity ω₁ and positioning command value θ_(o) are read in step 100 from the maximum velocity command signal 19 and positioning command signal 18 shown in FIG. 8, respectively.

In step 102, judgement is made as to whether or not the positioning command value θ_(o) is larger than the pregiven reference value θ_(c). When the result of judgement in step 102 proves that θ_(o) >θ_(c), the revolustion direction R_(w), position θ and velocity ω are read in step 104 from the revolution direction signal 11, position signal 12 and velocity signal 13 shown in FIG. 8, respectively. In step 106, the velocity command value ω_(N), duty factor D_(t) and forward/backward revolution R_(o) are calculated on the basis of the values of R_(w), θ and ω respectively. Then, in step 108, the microcomputer 9 applies the duty factor signal 14 and forward/backward revolution signal 15 shown in FIG. 8 to the drive circuit 8.

In step 110, judgement is made as to whether or not the position θ indicated by the position signal 12 has attained the pregiven reference value θ_(c) provided for the measurement of acceleration and deceleration of the motor 2. When the result of judgement in step 110 proves that the distance θ has not yet reached the value θ_(c), the program proceeds to step 114. On the other hand, when the result of judgement in step 110 proves that the distance θ has reached the value θ_(c), the velocity value ω at that time (the velocity ω of the motor 2 detected by the encoder 4) and the value of t_(c) indicative of the period of time required until attainment of the velocity ω_(c) are stored in the memory in step 112.

In step 114, the velocity ω is compared with the commanded maximum velocity ω₁. When the result of comparison in step 114 proves that ω<ω₁, the program returns to the step 104 so as to repeat the steps 104 to 114 again.

On the other hand, when the result of comparison in step 114 proves that ω=ω₁, the values of ω_(c) and t_(c) stored in step 112 in the memory are read out from the memory, and the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern are calculated in step 116.

The above steps complete the routine for the acceleration of the motor 2, and the routine for the steady operation of the motor 2 is then executed to control the motor 2 in the stage of steady revolution.

In step 118, the velocity ω is read from the velocity signal 13. In step 120, judgement is made as to whether or not the velocity ω is maintained at the commanded maximum velocity ω₁. When the result of judgement in step 120 proves that ω=ω₁, the program proceeds to step 126. On the other hand, when the result of judgement in step 120 proves that ω≠ω₁, the duty factor D_(t) and forward/backward revolution R_(o) are calculated in step 122, and the signals indicative of the calculated values of D_(t) and R_(o) are generated in step 124.

In step 126, the position θ is read from the position signal 12, and, in step 128, the position θ is compared with the deceleration-start remainder distance θ_(d1) (or θ_(d2)). When the result of comparison in step 128 proves that the distance θ_(d1) (or θ_(d2)) has not been reached, the motor 2 continues to run at the velocity ω₁ of steady revolution. On the other hand, when the result of comparison in step 128 proves that the distance θ_(d1) (or θ_(d2)) has been reached, the motor 2 is now decelerated.

In the routine for the motor deceleration, the previously calculated deceleration pattern is read out from the memory in step 130. In step 132, the position θ is read from the position signal 12, and, in step 134, the duty factor D_(t) and forward/backward revolution R_(o) are calculated on the basis of the deceleration pattern and position θ. In step 136, the signals indicative of the calculated values of D_(t) and R_(o) are generated.

In step 138, judgement is made as to whether or not the position θ has reached the position θ_(t) sufficient to stop the motor 2 at the desired position. When the result of judgment in step 138 proves that the position θ_(t) has been reached, the stop routine is started to stop the motor 2 according to the stop pattern. The value of θ_(t) above described is generally very small or ±1° to 2° in terms of the degree unit.

When the result of judgement in step 102 proves that the positioning command value θ_(o) is smaller than the pregiven reference value θ_(c) or θ_(o) <θ_(c), steps 140 to 148 are executed. In step 140, the previous values of ω_(c) and t_(c) stored in the memory (the pregiven values of ω_(c) and t_(c) stored in the memory in the case of initial positioning control) are read out to be used for the calculation of the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern.

Then, in step 142, the present velocity ω, present position θ and present direction of revolution R_(w) are read from the velocity signal 13, position signal 12 and revolution direction signal 11 respectively, and, in step 144, the duty factor D_(t) and forward/backward revolution R_(o) are calculated. Then, in step 146, the signals indicative of the calculated values of D_(t) and R_(o) are generated to start acceleration of the motor 2.

In step 148, the position θ is read from the position signal 12 to be compared with the deceleration-start remainder distance θ_(d1) (or θ_(d2)). When the result of comparison in step 148 proves that the distance θ_(d1) (or θ_(d2)) has not been reached, the acceleration steps 142 to 148 are repeated. On the other hand, when the result of comparison proves that the distance θ_(d1) (or θ_(d2)) has been reached, the program proceeds to the step 130 of the deceleration routine.

It will be seen from the above description that the method of the present invention includes the step in which judgement is made as to whether or not the positioning command value θ_(o) exceeds the pregiven reference value θ_(c), so that the optimum deceleration pattern for decelerating the motor 2 can be calculated on the basis of the data read or calculated during the stage of acceleration. Therefore, the motor position control apparatus according to the present invention can decelerate the motor smoothly without vibration according to the optimum deceleration pattern without being affected by variations of the inertia of the load and the current supplied to the motor.

In the method described with reference to FIG. 18, the velocity ω_(c) and time t_(c) at which the position θ has reached the pregiven reference position θ_(c) are stored in the memory to be used for the calculation of the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern. However, the velocity ω_(u) and position θ_(u) measured after lapse of a predetermined period of time t_(u) from arbitrarily selected time may be stored in the memory, and, on the basis of such values, the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern may be calculated to exhibit the effect similar to that above described.

Another embodiment of the method according to the present invention will be described with reference to a flow chart of FIG. 19. As described hereinbefore, the equation (13) provides the relation α₁ /α₂ =K_(ad). In the method to be described now, the sequence of starting-acceleration-steady operation-deceleration of the motor 2 is initially run prior to the actual operation to find the acceleration α₁ (or α₁ ') and deceleration α₂ (or α₂ '), to calculate the ratio K_(ad) therebetween, and to store the calculated value of K_(ad) in the memory. According to this method, the stored value of K_(ad) is read out from the memory in the actual operation of the motor 2, so that the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern can be calculated more accurately than when the value of K_(ad) is set at K_(ad) ≈1.

In the flow chart of FIG. 19, the block surrounded by the dotted lines and labelled "INIT" indicates a trial operation including a plurality of steps for calculating the value of K_(ad).

In step 200, the motor 2 is rotated in the forward direction of revolution, and, in step 202, the velocity ω is read from the velocity signal 13. In step 204, judgement is made as to whether or not the velocity ω has attained the commanded maximum velocity ω₁. When the result of judgement in step 204 proves that the velocity ω has reached the value ω₁, the acceleration α₁ =ω₁ /t₁ is calculated in step 206 on the basis of the value of ω₁ and the length of time t₁ required for the attainment of the commanded maximum velocity ω₁. Then, in step 208, the motor 2 is rotated in the backward direction of revolution, and, in step 210, the velocity ωis read from the velocity signal 13. In step 212, judgment is made as to whether or not the velocity ωis reduced to zero. When the result of judgment in step 212 proves that ω=0, the deceleration α₂ =ω₁ /t₂ is calculated in step 214 on the basis of the value of ω₁ and the length of time t₂ required for the velocity ω₁ to be reduced to zero. On the basis of the acceleration α₁ and deceleration α₂ thus calculated, the ratio K_(ad) is calculated and stored in the memory in step 216.

The value of K_(ad) thus obtained by the steps of the trial operation of the motor 2 is used for the calculation of the deceleration-start remainder distance θ_(d1) (or θ_(d2)) and deceleration pattern in the step 116 or 140 in the flow chart of FIG. 18.

Still another embodiment of the method according to the present invention will now be described. In the aforementioned embodiments, for example, in the embodiment shown in FIG. 18, the deceleration pattern is calculated in step 116 or 140 each time the position of the motor 2 is to be controlled. In contrast, in the embodiment which will be described now, a plurality of deceleration patterns are previously stored in the ROM of the microcomputer 9, and a most suitable one of them is selected each time the position of the motor 2 is to be controlled. Such an embodiment will be described with reference to a flow chart of FIG. 20.

The program starts from the stage of acceleration. In step 300, the positioning command value θ_(o) and maximum velocity command value ω₁ are read from the externally-applied positioning command signal 18 and maximum velocity command signal 19 respectively shown in FIG. 8.

Then, in step 302, the revolution direction R_(w), position θ and velocity ω of the motor 2 are read from the revolution direction signal 11, position signal 12 and velocity signal 13 respectively applied to the microcomputer 9 shown in FIG. 8. On the basis of these information, the velocity command value ω_(N), the duty factor D_(t) determining the voltage applied across the motor 2, and the forward/backward revolution R_(o) are calculated in step 304. In step 306, the duty factor signal 14 indicative of the calculated value of D_(t) and the forward/backward revolution signal 15 indicative of the calculated value of R_(o) are applied from the microcomputer 9 to the drive circuit 8 in FIG. 8.

In step 308, judgment is made as to whether or not the velocity ω has attained the commanded maximum velocity ω₁. When the result of judgment in step 308 proves that the velocity ω has not reached the value ω₁, the program returns to the step 302 to repeat the calculation of D_(t) and R_(o) and generation of the signals indicative of D_(t) and R_(o) again.

On the other hand, when the result of judgment in step 308 proves that the velocity ω has reached the value ω₁, the length of time t₁ required for the velocity ω to attain the commanded maximum velocity ω₁ is stored in the memory in step 310. Then, in step 312, the deceleration-start remainder distance θ_(d1) (or θ_(d2)) is calculated and stored in the memory.

The stage of acceleration is followed by the stage of steady operation. In step 314, the velocity ω is read from the velocity signal 13, and, in step 316, the velocity ω is compared with the commanded maximum velocity ω₁. When the result of comparison in step 316 proves that the velocity ω has reached the value ω₁, the program proceeds to step 318. On the other hand, when the result of comparison in step 316 proves that ω≠ω₁, the duty factor D_(t) and forward/backward revolution R_(o) are calculated again in step 320, and, in step 322, the signals 14 and 15 indicative of the new values of D_(t) and R_(o) respectively are applied from the microcomputer 9 to the drive circuit 8 for the purpose of velocity control. Then, in step 318, the position θ is read from the position signal 12, and judgment is made in step 324 as to whether the previously-calculated deceleration-start remainder distance θ_(d1) (or θ_(d2)) has been reached or not. When the result of judgment in step 324 proves that the distance θ_(d1) (or θ_(d2)) has not been reached, the program returns to the step 314 so as to continue the steady operation. On the other hand, when the result of judgment in step 324 proves that the distance θ_(d1) (or θ_(d2)) has been reached, a most suitable one of the plural deceleration patterns stored previously in the ROM is selected in step 326 on the basis of the value of t₁ stored in the memory in the stage of acceleration and indicative of the length of time required for the velocity ω to attain the commanded maximum velocity ω₁, so as to decelerate the motor 2 according to the selected deceleration pattern. When now the motor 2 starts to be decelerated, the position θ is read from the position signal 12 in step 328, and, in step 330, the duty factor D_(t) and forward/backward revolution R_(o) are calculated on the basis of the value of θ and the selected deceleration pattern. In step 332, the signals 14 and 15 indicative of the calculated values of D_(t) and R_(o) respectively are applied from the microcomputer 9 to the drive circuit 8.

In step 334, judgment is made as to whether or not the position θ has attained the value θ_(t) sufficient to stop the motor 2 at the desired position. When the result of judgment in step 334 proves that the distance θ_(t) has not yet been reached, the program returns to the step 328 so as to continue to decelerate the motor 2. On the other hand, when the result of judgment in step 334 proves that the distance θ_(t) has been reached, the motor 2 is stopped according to the stop pattern. This stop routine is executed when the motor 2 has rotated to the position at which the remainder distance is small enough to stop the motor 2 without the possibility of hunting.

FIG. 21 illustrates how such a deceleration pattern is selected from among a plurality of them, by way of example.

According to the present invention, the velocity ω relative to the position θ of the motor in the starting stage of acceleration is measured for calculating, for example, the deceleration-start remainder distance θ_(d1), θ_(d1) ', θ_(d1) "or θ_(d1) "', and a deceleration pattern most analogous to the acceleration pattern is selected from among a plurality of previously recorded or stored deceleration patterns A to D shown in FIG. 21.

When the acceleration pattern in the starting stage of acceleration of the motor rises as shown by, for example, the curve P in FIG. 21, the gradient of the rising curve is detected for calculating the deceleration-start remainder distance θ_(d1) ", and the deceleration pattern B having a gradient of its curve most analogous to the curve of the acceleration pattern P is selected in the motor position control. When, on the other hand, the acceleration pattern rises as shown by the curve Q in FIG. 21, the deceleration-start remainder distance θ_(d1) is calculated, and the deceleration pattern D having a gradient of its curve most analogous to the curve of the acceleration pattern Q is selected.

It will be understood from the above description of the third embodiment of the method according to the present invention that the deceleration-start remainder distance for stopping the motor at the desired position is calculated on the basis of data measured in the acceleration stage, and a deceleration pattern most suitable for decelerating and stopping the motor is selected from among a plurality of deceleration patterns stored previously in the ROM of the microcomputer. Therefore, the motor can be decelerated to stop according to the most suitable deceleration pattern regardless of variations of the motor characteristic and load condition, so that the position of the motor can be controlled smoothly without the possibility of hunting.

In the embodiment shown in FIG. 20, the length of time t₁ required for the velocity ω of the motor to attain the commanded maximum velocity ω₁ is measured to calculate the deceleration-start remainder distance and to select the most suitable deceleration pattern. However, the length of time required for the velocity ω of the motor to attain a velocity lower than the commanded maximum velocity ω₁ may be measured to calculate the deceleration-start remainder distance and to select the most suitable deceleration pattern, for achieving the effect similar to that above described.

Further, it is apparent that, instead of measuring the length of time t₁ required for the velocity ω of the motor to attain the commanded maximum velocity ω₁, the rate of change of the velocity ω within a predetermined period of time may be measured to calculate the deceleration-start remainder distance and to select the most suitable deceleration pattern, for achieving the effect similar to that above described. 

We claim:
 1. A method for controlling an angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein said method comprises the steps of:reading a commanded maximum velocity; detecting acceleration of the motor being accelerated in an initial acceleration stage of a motor position control operation; calculating a motor deceleration-start remainder angular distance and a velocity command value for decelerating the motor in a deceleration stage on the basis of said commanded maximum velocity and said detected acceleration; and decelerating the motor on the basis of said calculated motor deceleration-start remainder angular distance and said calculated deceleration velocity command value to stop the motor at an angular position commanded by said given positioning command value.
 2. A method for controlling an angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein said method comprises the steps of:comparing said given positioning command value with a predetermined reference value; detecting acceleration of the motor being accelerated in an initial acceleration stage of a motor position control operation when the result of comparison in the comparing step proves that said given positioning command value is not smaller than said predetermined reference value, and calculating a motor deceleration-start remainder angular distance and a velocity command value for decelerating the motor in a deceleration stage on the basis of said detected acceleration and an externally commanded maximum velocity, thereby generating signals indicative of said calculated motor deceleration-start remainder angular distance and said calculated deceleration velocity command value; generating signals indicative of a pregiven motor deceleration-start remainder angular distance and a pregiven deceleration velocity command value or generating signals indicative of the motor deceleration-start remainder angular distance and the deceleration velocity command value both used in the previous motor control operation, when the result of comparison in the comparing step proves that said given positioning command value is smaller than said predetermined reference value; and decelerating the motor on the basis of said motor deceleration-start remainder angular distance and said deceleration velocity command value provided by said signals to stop the motor at an angular position commanded by said given positioning command value.
 3. A method for controlling an angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein said method comprises the steps of:reading a commanded maximum velocity; detecting acceleration of the motor being accelerated in an initial acceleration stage of a motor position control operation; calculating a motor deceleration-start remainder angular distance on the basis of said commanded maximum velocity and said detected acceleration, selecting a most suitable deceleration pattern from among a plurality of previously stored deceleration patterns, and calculating a deceleration velocity command value for executing the control according to said selected deceleration pattern; and decelerating the motor on the basis of said calculated motor deceleration-start remainder angular distance and said calculated deceleration velocity command value to stop the motor at an angular position commanded by said given positioning command value.
 4. A method as claimed in claim 1, 2 or 3, wherein said acceleration is calculated by measuring the rate of change of the velocity of revolution of said rotary shaft per unit time.
 5. A method as claimed in claim 1, 2, or 3, wherein said acceleration is calculated by measuring the length of time required for said rotary shaft to make a unit change of the velocity of revolution.
 6. A method as claimed in claim 1 or 2, wherein said velocity command value for decelerating the motor in the deceleration stage is calculated on the basis of the principle that its square value is proportional to the product of said acceleration and said motor deceleration-start remainder angular distance.
 7. A method as claimed in claim 1, 2 or 3, wherein said method further comprises the step of calculating the ratio between the acceleration and the deceleration of the motor by driving the motor through the stages of acceleration, steady operation and deceleration prior to the motor position control operation started in response to said given positioning command value, said ratio being used for the calculation of said motor deceleration-start remainder angular distance and said deceleration velocity command value during the motor position control operation started in response to said given positioning command value.
 8. An apparatus for controlling an angular position of a rotary shaft of a motor, comprising an encoder supported on the rotary shaft and for encoding the angular position of the rotary shaft, and a control circuit for applying a positive or negative variable voltage across said motor in response to a given positioning command value, wherein said control circuit comprises:means for receiving said given positioning command value; means for detecting the revolution velocity and angular position of said rotary shaft on the basis of an output of said encoder; signal processing means for calculating acceleration of the motor in an initial acceleration stage of a motor position control operation, a motor deceleration-start remainder angular distance and a velocity command value for decelerating the motor in a deceleration stage on the basis of said given positioning command value, said detected velocity and said detected angular position; and means for driving said motor by applying said positive or negative variable voltage across said motor on the basis of the results of calculation.
 9. An apparatus for controlling an angular position of a rotary shaft of a motor, comprising an encoder supported on the rotary shaft and for encoding the angular position of the rotary shaft, and a control circuit for applying a positive or negative variable voltage across said motor in response to a given positioning command value, wherein said control circuit comprises:means for receiving said given positioning command value; means for detecting the revolution velocity and angular position of said rotary shaft on the basis of an output of said encoder; means for receiving a maximum velocity command value; signal processing means for processing signals indicative of said given positioning command value, said maximum velocity command value, said detected velocity and said detected angular position and generating the results of signal processing; means for driving said motor by applying said positive or negative variable voltage across said motor on the basis of the results of signal processing by said signal processing means; and said signal processing means calculating accleration of the motor being acclerated in an initial acceleration stage of a motor position control operation on the basis of said signals indicative of the velocity and angular position of the rotary shaft when the result of comparison between said given positioning command value and a predetermined reference value proves that the former is not smaller than the latter, and calculating a motor deceleration-start remainder angular distance and a deceleration velocity command value on the basis of said calculated accleration and said given maximum velocity for generating them as said results of signal processing.
 10. An apparatus as claimed in claim 8 or 9, wherein said signal processing means is a microcomputer.
 11. A method for controlling an angular position of a motor equipped on its rotary shaft with an encoder for encoding the angular position of the motor under rotation so that the angular position of the motor can be controlled in response to a given positioning command value, wherein said method comprises the steps of:reading a commanded maximum velocity; detecting acceleration stage of a motor being accelerated in an initial acceleration stage of a motor position control operation, said acceleration being calculated by measuring the rate of change of the velocity of revolution of said rotary shaft per unit time; calculating a motor deceleration-shaft remainder angular distance and a velocity command value for decelerating the motor in a deceleration stage on the basis of said command maximum velocity and said detected acceleration; and decelerating the motor on the basis of said calculated motor deceleration-start remainder angular distance and said calculated deceleration velocity command value to stop the motor at an angular position commanded by said given positioning command value. 